<!doctype html>

<html>

  <head>
    <meta charset="utf-8">
    <title>WASM Table example</title>
  </head>

  <body>
    <script>
      WebAssembly.instantiateStreaming(fetch("wasm-table.wasm"))
      .then(obj => {
        console.log(obj.instance.exports.callByIndex(0)); // returns 42
        console.log(obj.instance.exports.callByIndex(1)); // returns 13
        console.log(obj.instance.exports.callByIndex(2)); // throws an error, because there is no index position 2 in the table
      });
    </script>
  </body>

</html>
